package com.youths.service.impl;

import com.youths.dao.ScoreMapper;
import com.youths.domain.Score;
import com.youths.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by IntelliJ IDEA.
 * User: KingRainGrey
 * Date: 2020/7/11
 */
@Service
public class ScoreServiceImp implements ScoreService {
    @Autowired(required = false)
    ScoreMapper scoreMapper;

    @Override
    public int addScore(Score score) {
        int result = scoreMapper.add(score);
        if (result > 0) {
            return score.getScoreId();
        }else {
            return 0;
        }
    }

    @Override
    public int updateBoneage(Score score) {
        return scoreMapper.updateBoneage(score);
    }

    @Override
    public int update(Integer scoreId, String suggestion, Integer state) {
        return scoreMapper.update(scoreId, suggestion, state);
    }

    @Override
    public Score queryScore(Integer recoId) {
        return scoreMapper.query(recoId);
    }
}
